/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.liquidByte.trafficMustang.server.webService;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.liquidByte.trafficMustang.server.dataModel.Veiculo;
import org.liquidByte.trafficMustang.server.services.ConverterService;
import org.liquidByte.trafficMustang.server.services.VeiculoService;
import org.liquidByte.trafficMustang.server.webService.base.WebService;

/**
 * REST Web Service
 *
 * @author Alexandre
 */
@Stateless
@Path("veiculo")
public class VeiculoWebService extends WebService {
    
    @EJB
    private VeiculoService veiculoService;
    @EJB
    private ConverterService converter;
    
    @GET
    @Produces("application/json")
    @Path("get")
    public String get() {
        try {
            List<Veiculo> list = this.veiculoService.get();
            return this.result(this.converter.getVeiculo().convert(list));
        } catch (Exception e) {
            return this.error(e);
        }
    }
}
